/*
 * @Description: 
 * @Author: charles
 * @Date: 2021-11-17 11:19:20
 * @LastEditors: charles
 * @LastEditTime: 2021-11-18 11:23:39
 */
import { createStore } from 'vuex'
import {get} from '../utils/request'
export default createStore({
  state: {
    categories:[]
  },
  mutations: {
    SET_CATEGORIES(state,playload){
      state.categories = playload;
    }
  },
  actions: {
    async loadCategories({commit}){
      let url = "/category/findAll"
      let resp = await get(url);
      commit('SET_CATEGORIES',resp.data)
    }
  },
  modules: {
  }
})
